<!DOCTYPE html>
<html>
<head>
    <title>产品信息</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <!--
             查类别、出版社、作者、上市日期和编码
             -->
            <div class="form-group col-sm-2">
                <input type="text" class="form-control" v-model="q.name" @keyup.enter="query" placeholder="名称">
            </div>
            <div class="form-group col-sm-2">
                <select class="form-control"   v-model="q.type">
                    <option value="">请选择类别</option>
                    <option v-for="l in types" :value="l.id">{{l.name}}</option>
                </select>
            </div>
            <div class="form-group col-sm-2">
                <input type="text" class="form-control" v-model="q.chuban" @keyup.enter="query" placeholder="生产公司">
            </div>
            <div class="form-group col-sm-2">
                <input type="text" class="form-control" v-model="q.author" @keyup.enter="query" placeholder="负责人">
            </div>
            <div class="form-group col-sm-2">
                <input type="text" class="form-control" v-model="q.code1" @keyup.enter="query" placeholder="编码">
            </div>
            <a class="btn btn-default" @click="query">查询</a>
            #if($shiro.hasPermission("book:update"))
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            #end
            #if($shiro.hasPermission("book:delete"))
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
            #end
            <a class="btn btn-primary" @click="info"><i class="fa fa-info"></i>&nbsp;详情</a>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-success">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal" onsubmit="return false">
            <div class="form-group">
                <div class="col-sm-2 control-label">名称</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" :disabled="showInfo" v-model="book.name" placeholder="名称"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">类别</div>
                <div class="col-sm-10">
                    <select class="form-control" :disabled="showInfo" v-model="book.type">
                        <option v-for="l in types" :value="l.id">{{l.name}}</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">生产公司</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" :disabled="showInfo" v-model="book.chuban"
                           placeholder="生产公司"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">负责人</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" :disabled="showInfo" v-model="book.author"
                           placeholder="负责人"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">上市日期</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" :disabled="showInfo" v-model="book.time"

                           onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss', choose: function(date){vm.book.time=date;}})"
                           placeholder="上市日期"/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label">所在位置</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" :disabled="showInfo" v-model="book.area" placeholder="所在位置"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">介绍</div>
                <div class="col-sm-10">
                    <textarea class="form-control" :disabled="showInfo" v-model="book.content" placeholder="介绍"
                              cols="30" rows="5"></textarea>
                </div>
            </div>
            <div class="form-group" v-if="showInfo">
                <div class="col-sm-2 control-label">状态</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" :disabled="showInfo" v-model="book.state" placeholder="状态"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">rfid唯一编码</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" :disabled="showInfo" v-model="book.code"
                           placeholder="rfid唯一编码"/>
                </div>
            </div>
            <div class="form-group" v-if="showInfo">
                <div class="col-sm-2 control-label">添加时间</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" :disabled="showInfo" v-model="book.gmttime"
                           placeholder="添加时间"/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定" v-if="!showInfo"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-default" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<script src="${rc.contextPath}/js/admin/book.js?_${date.systemTime}"></script>
</body>
</html>